home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00a.txt / 000057_icon-group-sender _Mon Apr 10 10:15:07 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id KAA11195
  4.     for icon-group-addresses; Mon, 10 Apr 2000 10:14:54 -0700 (MST)
  5. Message-Id: <200004101714.KAA11195@baskerville.CS.Arizona.EDU>
  6. Date: Mon, 10 Apr 2000 09:58:51 -0700
  7. From: Steve Wampler <swampler@noao.edu>
  8. X-Accept-Language: en
  9. To: "F.G. van DORP" <F.G.van.Dorp@digimedia.nl>,
  10.         icon-group <icon-group@optima.CS.Arizona.EDU>
  11. Subject: Re: Reversible assignment really reversible ?
  12. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  13. Status: RO
  14.  
  15. "F.G. van DORP" wrote:
  16. > # WINICON 9.3.1
  17. > procedure main()
  18. > local i1,i2,i3,j1,j2,k,a1,a2,a3
  19. > i1:=2
  20. > j1:=4
  21. > i2:=4; i3:=i2
  22. > j2:=2
  23. > k:=3
  24. > # co-exp creation & @ctivation not really necessary
  25. > a1:=create((i1 <- j1) > k)
  26. > a2:=create((i2 <- j2) > k)
  27. > a3:=create(((i2:=j2)|(i2:=i3)) > k)
  28. > write(@a3)
  29. > write("co-exp1: ",@a1)
  30. > write("nested1: ",((i1 <- j1) > k))
  31. > write("muteva1: ",((i1 <- j1) & (i1 > k)))
  32. > # the following set doesn't work, so is   <-
  33. > # really implemented or just an alias for :=  ?
  34. > write("co-exp2: ",@a2)
  35. > write("nested2: ",((i2 <- j2) > k))
  36. > write("muteva2: ",((i2 <- j2) & (i2 > k)))
  37. > end
  38.  
  39. Reversible assignment really works, but not as you're picturing its use.
  40. The assignment is reversible only so long as you're staying in the same
  41. evaluation context (w.r.t. success and failure).  That is, the assignment
  42. reverses ONLY if you backtrack into it.  Try the following:
  43.  
  44.    i1 := 0
  45.    every write("i1 is ", i1 <- 1 to 3)
  46.    write("i1 is now ", i1)
  47.  
  48. Also note that reversible assignment fails after it has reversed itself.
  49.  
  50. --
  51. Steve Wampler-  SOLIS Project, National Solar Observatory
  52. swampler@noao.edu
  53.